/*! \file   classnode.h
	\author HiddenSeeker

	Describees a node, describing a class definition
*/
#include "inheritancenode.h"
#include "creator.h"
#include "converter.h"
#include "feature.h"
#include <string>
#pragma once
/*! Class modifier data
*/
enum ClassModifier
{
	CLM_NONE=0,
	CLM_DEFERRED=1,
	CLM_FROZEN=2
};
/*! Class of node
*/
class ClassNode: public AbstractNode
{
 private:
	      std::string  *              m_name;
		  ClassModifier               m_modifier;
		  ListNode<InheritanceNode> * m_inherits;
		  ListNode<CreatorNode>     * m_creators;
		  ListNode<ConverterNode>   * m_converters;
		  ListNode<FeatureGroup>    * m_features;
 public:
	      inline   ListNode<InheritanceNode> *& inherits()  { return m_inherits; }
		  inline   ListNode<CreatorNode>     *& creators()  { return m_creators; }
		  inline   ListNode<ConverterNode>   *& converters()  { return m_converters; }
		  inline   ListNode<FeatureGroup>    *& features()   { return m_features; } 
		  inline ClassNode(const YYLTYPE & pos, std::string * data): AbstractNode(pos)
		  {
			  m_name=data;
			  m_modifier=CLM_NONE;
			  m_inherits=NULL;
			  m_creators=NULL;
			  m_features=NULL;
			  m_converters=NULL;
		  }
		  
		  inline const std::string & name() const { return *m_name; }
		  inline const ClassModifier type() const { return m_modifier; }
		  inline void  setType(ClassModifier m)   { m_modifier=m; }
		  /*! Writes a node data to stream
		   */
		  void write(GraphStream * s);
		  
		  inline ~ClassNode()
		  {
			  if (this->isOwningData())
			  {
				  delete m_name;
				  delete m_converters;
				  delete m_inherits;
				  delete m_creators;
				  delete m_features;
			  }
		  }
};
